package org.sky.sys.api.fallback;

import feign.hystrix.FallbackFactory;
import org.sky.sys.api.ISysOrganClientRemoteApi;
import org.sky.sys.entity.SysOrgan;
import org.springframework.stereotype.Component;

/**
 * @author weifx
 * @Title: SysOrganClientFallbackFactory
 * @ProjectName microserviceCloud
 * @Description: TODO消费端服务降级
 * @date 2019/1/2115:08
 * @Version 1.0
 */
@Component
public class SysOrganClientFallbackFactory implements FallbackFactory<ISysOrganClientRemoteApi> {
    @Override
    public ISysOrganClientRemoteApi create(Throwable throwable) {
        return new ISysOrganClientRemoteApi() {
            @Override
            public SysOrgan getSysOrganByCode123(String code) {
                return new SysOrgan().setId("404")
                        .setCode("404")
                        .setName("未找到该部门 from SysOrganClientFallbackFactory");
            }
        };
    }
}
